package com.cheng.student.utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class GetJsonUtil
{
    public static String getJson(Object object)
    {
        ObjectMapper objectMapper = new ObjectMapper();

        String json = null;

        try
        {
            json = objectMapper.writeValueAsString(object);
        }
        catch (JsonProcessingException e)
        {
            e.printStackTrace();
        }

        return json;
    }
}
